<?php
error_reporting(0);
ini_set('memory_limit', '1000M');
// Define path to application directory
defined('APPLICATION_PATH')
    || define('APPLICATION_PATH', realpath(dirname(__FILE__) . '/../application'));


// Define application environment
if (preg_match('/^tt.localhost$/i', $_SERVER['HTTP_HOST'])) {
    $environment = 'development';
  }    
 else {
    $environment = 'production';
}

// Define application environment
define('APPLICATION_ENV',$environment);
defined('APPLICATION_ENV')
    || define('APPLICATION_ENV', (getenv('APPLICATION_ENV') ? getenv('APPLICATION_ENV') : 'production'));

// Ensure library/ is on include_path
set_include_path(implode(PATH_SEPARATOR, array(
    realpath(APPLICATION_PATH . '/../library'),
    get_include_path(),
)));

/** Zend_Application */
require_once 'Zend/Application.php';
require_once 'Zend/Controller/Front.php';
require_once 'Zend/Controller/Plugin/ErrorHandler.php';
require_once 'Zend/Mail/Transport/Smtp.php';
Zend_Loader::loadClass ( 'Zend_Config_Ini' );
//Zend_Loader::loadClass ( 'Zend_Config_XML' );
Zend_Loader::loadClass ( 'Zend_Registry' );
Zend_Loader::loadClass ( 'Zend_Db' );
Zend_Loader::loadClass ( 'Zend_Json_Encoder' );
Zend_Loader::loadClass ( 'Zend_Json_Decoder' );
Zend_Loader::loadClass ( 'Zend_Session_Namespace' );
Zend_Loader::loadClass ( 'Zend_Validate_EmailAddress' );
Zend_Loader::loadClass ( 'Zend_Session' );
Zend_Loader::loadClass ( 'Zend_Layout' );
Zend_Loader::loadClass ( 'Zend_Http_Cookie' );
Zend_Loader::loadClass ( 'Zend_Http_CookieJar' );
Zend_Loader::loadClass ( 'Zend_Feed_Rss' );
Zend_Loader::loadClass ( 'Zend_Feed' );
Zend_Loader::loadClass ( 'Zend_Feed_Builder' );
Zend_Loader::loadClass ( 'Zend_Mail' );
Zend_Loader::loadClass ( 'Zend_Controller_Router_Rewrite' );
Zend_Loader::loadClass ( 'Zend_Controller_Router_Route_Regex' );
Zend_Loader::loadClass ( 'Zend_XmlRpc_Client' );

 // Create application, bootstrap, and run
$application = new Zend_Application(
    APPLICATION_ENV,
    APPLICATION_PATH . '/configs/application.ini'
);
include(APPLICATION_PATH.'/../library/Custom/functions.php');
$application->bootstrap()
            ->run();
